 varying vec2 vTextureCoord;
    uniform sampler2D uSampler;

    uniform vec2 uResolution;
    uniform float uRadius;

    vec4 blur(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
        vec4 color = vec4(0.0);
        float total = 0.0;

        for (float i = -uRadius; i <= uRadius; i += 1.0) {
            float percent = (i + uRadius) / (uRadius * 2.0);
            float weight = percent - percent * percent;
            vec4 sample = texture2D(image, uv + direction * i / resolution);
            color += sample * weight;
            total += weight;
        }

        return color / total;
    }

    void main(void) {
        vec4 color = blur(uSampler, vTextureCoord, uResolution, vec2(1.0, 0.0));
        color += blur(uSampler, vTextureCoord, uResolution, vec2(0.0, 1.0));
        gl_FragColor = color / 2.0;
    }
